#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int L = 0, R = 0, count = 0;
	cin >> L >> R;
	for (int i = L; i <= R; i++)
	{
		int ans = i;
		while (ans > 0)
		{
			if (ans % 10 == 2)
			{
				count++;
			
			}
			ans /= 10;
		}
	}
	cout << count;
	return 0;
}